/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cz.muni.fi.PA165.musiclibrarybackend.dao;

import cz.muni.fi.PA165.musiclibrarybackend.entities.Song;
import java.util.List;

/**
 * This interface allows to manipulate with songs.
 * @author xbogar
 */
public interface SongDAO {
     
    /**
     * Creates a new song and stores it into database. Id for the 
     * new song is automatically generated and stored into id attribute.
     * 
     * @param song song to be created.
     * @throws IllegalArgumentException when song is null or song is without name, 
     * author or album.
     * @throws IllegalEntityException when song has already assigned id.
     */   
    public void createSong(Song song);
    
    /**
     * Returns song with given id.
     * 
     * @param id primary key of requested song.
     * @return song with given id or null if such body does not exist.
     * @throws IllegalArgumentException when given id is null.
     */   
    public Song getSong(Long id);
    
    /**
     * Returns list of all songs in the database.
     * 
     * @return list of all songs in database.
     */
    public List<Song> getAllSongs();
    
    /**
     * Updates song in database.
     * 
     * @param song updated song to be stored into database.
     * @throws IllegalArgumentException when song is null or has null id.
     * @throws IllegalEntityException when song does not exist in the database.
     */   
    public void updateSong(Song song);
    
    /**
     * Deletes song from database. 
     * 
     * @param song song to be deleted from database.
     * @throws IllegalArgumentException when song is null or author has null id.
     * @throws IllegalEntityException when song does not exist in the database.
     */   
    public void deleteSong(Song song);
}
